const { DataTemplateModel } = require('../../models/models');


function addTemplate(json){
    const {username,templateId} = json;
    return new Promise((res) =>{
        DataTemplateModel.updateOne({username,templateId},json,{
            upsert:true,
            multi:true
        }).then(docs =>res({status:0,data:docs}))
        .catch(err =>{
            console.log(err)
            res({status:1})})
    })
}


module.exports = addTemplate;